package cn.myschool.java79.test1;

import cn.myschool.java79.dao.StudentMapper;
import cn.myschool.java79.entity.Student;
import cn.myschool.java79.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.defaults.DefaultSqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
//一级缓存，基于session
public class Level1Cache {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        StudentMapper studentMapper=s.getMapper(StudentMapper.class);
        List<Student> list1 = studentMapper.search1("王", "3");
        System.out.println(list1);
        //s.clearCache();
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        List<Student> list2= studentMapper.search1("王", "3");
        System.out.println(list2);
        MybatisUtil.close(s);
    }
}
